package cn.hhj.feign;

import cn.hhj.domain.User;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class OrderFallbackFactory implements FallbackFactory<UserServer> {
    @Override
    public UserServer create(Throwable throwable) {
        throwable.printStackTrace();
        return new UserServer() {
            @Override
            public User getById(Long id) {
                return new User(-1L,"熔断了","当前请求服务不可用，请稍后重试！");
            }
        };
    }
}
